<?php
namespace models\repositories;
use Doctrine\ORM\EntityRepository;
use entities;
class BerkasCommentRepository extends EntityRepository {
	
	public function findLastBerkasComment($berkasId){
		$rsm = new \Doctrine\ORM\Query\ResultSetMapping;
		$rsm->addScalarResult("text", "text");
		
		$query = $this->_em->createNativeQuery("select text from berkas_comment where id in (select max(id) from berkas_comment where berkas_id = '".$berkasId."')",$rsm);
		$str = $query->getResult();
		//echo $query->getSQL();
		//echo "<pre>";print_r($str);die();		
		return $str;
	}
}

